<!-- 移动位置并添加指令 -->
<template>
	<view>
		<view style="height: 40rpx;width: 750rpx;background-color: #fff;"></view>
		<!-- 顶部 -->
		<view class="top">
			<view class="back" @click="$win.back()">
				<view>
					<image src="/static/iconfont/arrow-left-bold.png" mode="aspectFill"></image>
				</view>
				<text>移动位置并添加指令</text>
			</view>
		</view>
		<!-- 地图 -->
		<view class="map">
			<map name="marker" scale="20" :polyline="polyline"  :longitude="longitude"
				:latitude="latitude" show-compass="true" enable-rotate="true"
				style="width: 750rpx;height: 809rpx;"></map>
		</view>

		<!-- 标记指令 -->
		<view class="box">
			<view class="son" v-for="(k,i) in 9">
				<image src="" mode="aspectFill"></image>
				<text>上车准备</text>
			</view>
		</view>

		<!-- 保存 -->
		<button class="save">保存</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				longitude: '',
				latitude: '',
				//路线
				polyline: [{}],
				// 标记点
				markers: [{}]
			}
		},
		methods: {
			getLocation() {
				uni.getLocation({
					type: 'wgs84',
					isHighAccuracy:true,
					success: (res) => {
						console.log('当前位置的经度：' + res.longitude);
						console.log('当前位置的纬度：' + res.latitude);
						console.log('精度',res.accuracy)
						this.longitude = res.longitude
						this.latitude = res.latitude
					}
				})
			}
		},
		onLoad() {
			this.getLocation()
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f2f3f5;
	}

	.top {
		display: flex;
		flex-direction: row;
		align-items: center;
		width: 750rpx;
		height: 88rpx;
		background: #ffffff;

		.back {
			display: flex;
			flex-direction: row;
			align-items: center;

			view {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 88rpx;
				height: 88rpx;

				image {
					width: 20rpx;
					height: 34rpx;
				}
			}

			text {
				height: 34rpx;
				line-height: 34rpx;
				font-size: 34rpx;
				font-family: Source Han Sans CN, Source Han Sans CN-Regular;
				font-weight: 400;
				text-align: left;
				color: #333333;
			}
		}
	}

	.box {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		margin-top: 3rpx;
		width: 100%;
		max-height: 293rpx;
		overflow-y: auto;

		// background-color: pink;
		.son {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			width: 25%;
			height: 187rpx;
			box-sizing: border-box;
			border: 2rpx solid #f2f3f5;
			background-color: #ffffff;

			image {
				width: 90rpx;
				height: 90rpx;
				// border-radius: 50%;
				background-color: skyblue;
			}

			text {
				margin-top: 12rpx;
				max-width: 150rpx;
				font-size: 24rpx;
				font-family: Source Han Sans CN, Source Han Sans CN-Regular;
				font-weight: 400;
				text-align: center;
				color: #333333;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;

			}
		}
	}

	.save {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 750rpx;
		height: 104rpx;
		line-height: 104rpx;
		background: linear-gradient(134deg, #54d685, #29c563 99%);
		font-size: 32rpx;
		font-family: Source Han Sans CN, Source Han Sans CN-Regular;
		font-weight: 400;
		text-align: center;
		color: #ffffff;
	}
</style>
